package website.haicheng.server.controller;

import website.haicheng.server.config.NettyManage;
import website.haicheng.server.model.dto.MessageDto;
import website.haicheng.server.model.vo.Resp;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author: 582895699@qq.com
 * @Desctription: 发送消息
 * @Date: Created in 2021/12/2 10:51
 */
@RestController
public class ServerController {

    @Resource
    private NettyManage nettyManage;

    /**
     * 向客户端下发命令
     *
     * @param dto MessageDto
     * @return Resp
     */
    @RequestMapping(value = "/send")
    public Resp sendToAll(@RequestBody MessageDto dto) {
        nettyManage.send(dto);
        return Resp.ok();
    }
}
